package com.ltw.modules.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ltw.modules.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * @Description Clazz
 * @Author HymanHu
 * @Date 2021/9/14 13:55
 */
@Entity
@Table(name="test_clazz")
public class Clazz extends AbstractEntity {
    private String ClazzName;

    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinTable(name = "test_clazz_student",
            joinColumns = @JoinColumn(name="clazz_id"),
            inverseJoinColumns = @JoinColumn(name="student_id"))
    private List<Student> students;

    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "school_id")
    @JsonIgnore
    private School school;

    public String getClazzName() {
        return ClazzName;
    }

    public void setClazzName(String clazzName) {
        ClazzName = clazzName;
    }

    public List<Student> getStudents() {
        return students;
    }

    public void setStudents(List<Student> students) {
        this.students = students;
    }

    public School getSchool() {
        return school;
    }

    public void setSchool(School school) {
        this.school = school;
    }
}
